package com.bawei.liuzhanlin20210806.presenter;

import android.content.Context;

import com.bawei.liuzhanlin20210806.contract.MainContract;
import com.bawei.liuzhanlin20210806.model.bean.ShouyeBean;
import com.bawei.liuzhanlin20210806.model.utils.HttpUtils;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

/**
 * Time: 2021/8/6
 * Author:liuzhanlin
 * Description:zhuangao6
 */
public class MainPresenter extends BasePresenter<MainContract.MainView> implements MainContract.IMainContract {
    @Override
    public void getdata(Context context) {
        HttpUtils.getInstance().getApiService().syservice()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<ShouyeBean>() {
                    @Override
                    public void accept(ShouyeBean shouyeBean) throws Exception {
                        getView().success(shouyeBean);
                    }
                });
    }
}
